<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------

use think\facade\Route;

Route::pattern('id', '\d+');

Route::get('/', function(){
    dump("Index");
    return welcome();
});
/**
 * 后台管理模块
 */
Route::group('admin', function(){
    // 登录模块
    Route::group('login', function(){
        Route::get('/', 'admin/Login/login');
        Route::post('input', 'admin/Login/input');
        Route::get('logout', 'admin/Login/logout');
    });
    Route::get('qiniuToken', 'admin/Common/qiniuToken');
    Route::group('', function(){
        //rbac
        Route::group('rbac', function(){
            Route::get('table', function(){
                (new \gmars\rbac\Rbac())->createTable();
            });
        });
        //首页
        Route::get('/', 'admin/Index/index');
        Route::get('welcome', 'admin/Index/welcome');
        Route::get('icon', 'admin/Index/getIcon');
        //公共操作
        Route::controller('common', 'admin/Common');
        // 管理员模块
        Route::group('admin', function(){
            Route::get('admin/skin/:skin','admin/admin.Administrator/skin')->validate('app\admin\validate\Admin', 'skin');
            Route::get('admin/status/:id', 'admin/admin.Administrator/status')->model('\app\admin\model\admin\Admin');
            Route::get('admin/only', 'admin/admin.Administrator/only');
            Route::delete('admin/destory', 'admin/admin.Administrator/destory');
            Route::resource('admin', 'admin/admin.Administrator')->model('\app\admin\model\admin\Admin');
            Route::get('permission/status/:id', 'admin/admin.Permission/status')->model('\app\admin\model\admin\Permission');
            Route::get('permission/auto', 'admin/admin.Permission/auto');
            Route::delete('permission/destory', 'admin/admin.Permission/destory');
            Route::resource('permission', 'admin/admin.Permission');
            Route::get('permissionCategory/status/:id', 'admin/admin.PermissionCategory/status')->model('\app\admin\model\admin\PermissionCategory');
            Route::get('permissionCategory/only', 'admin/admin.PermissionCategory/only');
            Route::delete('permissionCategory/destory', 'admin/admin.PermissionCategory/destory');
            Route::resource('permissionCategory', 'admin/admin.PermissionCategory');
            Route::get('roles/status/:id', 'admin/admin.Roles/status')->model('\app\admin\model\admin\Role');
            Route::delete('roles/destory', 'admin/admin.Roles/destory');
            Route::resource('roles', 'admin/admin.Roles');
            Route::get('menus/status/:id', 'admin/admin.Menus/status')->model('\app\admin\model\admin\Menus');
            Route::get('menus/only', 'admin/admin.Menus/only');
            Route::delete('menus/destory', 'admin/admin.Menus/destory');
            Route::resource('menus', 'admin/admin.Menus')->model('\app\admin\model\admin\Menus');
        });
        //点读机模块
        Route::group('erm', function(){
            Route::get('sidebar/status/:id', 'admin/erm.Sidebar/status')->model('\app\admin\model\erm\Sidebar');
            Route::get('sidebar/only', 'admin/erm.Sidebar/only');
            Route::delete('sidebar/destory', 'admin/erm.Sidebar/destory');
            Route::resource('sidebar', 'admin/erm.Sidebar')->model('\app\admin\model\erm\Sidebar');
            Route::get('books/status/:id', 'admin/erm.Books/status')->model('\app\admin\model\erm\Books');
            Route::get('books/only', 'admin/erm.Books/only');
            Route::delete('books/destory', 'admin/erm.Books/destory');
            Route::resource('books', 'admin/erm.Books')->model('\app\admin\model\erm\Books');
            Route::get('booksContents/status/:id', 'admin/erm.booksContents/status')->model('\app\admin\model\erm\BooksContents');
            Route::delete('booksContents/destory', 'admin/erm.booksContents/destory');
            Route::resource('booksContents', 'admin/erm.BooksContents')->model('\app\admin\model\erm\BooksContents');
        });
        //用户模块
        Route::group('user', function(){
            Route::get('info/status/:id', 'admin/user.Info/status')->model('\app\admin\model\user\UserNumber');
            Route::get('info/only', 'admin/user.Info/only');
            Route::resource('info', 'admin/user.Info')->model('\app\admin\model\user\UserNumber');
        });
        //客服模块
        Route::group('customer', function(){
            Route::resource('message', 'admin/customer.Message');
        });
    })->middleware([
        \app\http\middleware\IfLogin::class,
        \app\http\middleware\AuthUpdate::class
    ]);
});

return [

];
